package com.xuyuan.reflect.method;

import com.xuyuan.reflect.TestCommonClass;
import org.apache.commons.lang3.reflect.MethodUtils;
import org.junit.jupiter.api.Test;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class Lang3MethodUtils {
    @Test
    public void test() {
        Method method1 = MethodUtils.getAccessibleMethod(TestCommonClass.class, "method1");
        System.out.println(method1.getName());
    }

    @Test
    public void test2() throws InvocationTargetException, NoSuchMethodException, IllegalAccessException {
        TestCommonClass testCommonClass = new TestCommonClass();
        Object object = MethodUtils.invokeMethod(testCommonClass, true, "method2");
        System.out.println(object);
    }
}
